var sum1 = 0;
		var sum2 = 0;
		var shijian = 0;
		window.onkeydown = function() {
			var key = event.keyCode;
			var center = document.getElementById("center");
			for(var i = 0; i < center.children.length; i++) {
				var keydom = center.children[i].getAttribute("keydom")
				if(key == keydom) {
					center.removeChild(center.children[i]);
					sum1++
					break;
				}
			}
		}

		function kaishi() {
			ic = setInterval('setPG()', 1000);
			id = setInterval('yidong()', 100);
			ie = setInterval('zhengquelu()', 1000)
		}

		function setPG() {
			var center = document.getElementById("center");
			var div = document.createElement("div");
			var num = parseInt(Math.random() * 26) + 65;
			div.innerHTML = "&#" + num + ";";
			div.setAttribute("keydom", num);
			div.style.top = "0px";
			div.style.left = parseInt(Math.random() * 700) + 10 + "px";
			center.appendChild(div);
			//			console.log(sum1)
		}

		function yidong() {
			var center = document.getElementById("center");
			center.children.className = "pg";
			for(var i = 0; i < center.children.length; i++) {
				t = parseInt(center.children[i].style.top)
				t += 10;
				center.children[i].style.top = t + "px";
				if(t > 380) {
					center.children[i].className = "posui";
					center.children[i].innerHTML = '';
					sum2++;
					//					console.log("破碎"+sum2)

				}
				if(t > 400) {
					center.removeChild(center.children[i]);
				}
			}
		}

		function zhanting() {
			clearInterval(id);
			clearInterval(ic);
			clearInterval(ie);
		}

		function jieshu() {
			zhanting();
			var span1 = document.getElementById('span1');
			var span2 = document.getElementById('span2');
			var span3 = document.getElementById('span3');
				ing.style.display="none"
			span1.innerHTML="100%"
			span2.innerHTML="0秒"
			span3.innerHTML="0字/分钟"
			var center = document.getElementById("center");
			var m = center.children.length
			for(var i = 0; i < m; i++) {
				center.removeChild(center.children[0]);
			}
		}

		function zhengquelu() {
			shijian++
			var span1 = document.getElementById('span1');
			var span2 = document.getElementById('span2');
			var span3 = document.getElementById('span3');
			var ing=document.getElementById("ing");
			if (sum1==10) {
				ing.style.display="block"
			}
			if(sum1 + sum2 > 0) {
				span1.innerHTML = parseInt((sum1 / (sum1 + sum2)) * 100) + "%"
			}
			span2.innerHTML = shijian + "秒"
			span3.innerHTML = parseInt(sum1 / shijian * 60) + "字/分钟"
		}